'''
Created on Nov 29, 2011

@author: anorberg
'''
import sys
import csv

ALARM_COLUMN = 10

def filterAlarmRows(tableFile, targetFile, alarmLevel, column):
    table = csv.reader(tableFile, dialect=csv.excel_tab)
    for row in table:
        if int(row[column]) >= alarmLevel:
            print >> targetFile, "\t".join(row)
    targetFile.flush()

if __name__ == '__main__':
    alarmLevel = 2
    if len(sys.argv) >= 2:
        alarmLevel = int(sys.argv[1])
    
    inputFile = sys.stdin
    if len(sys.argv) >= 3:
        if(sys.argv[2] != '-'):
            inputFile = open(sys.argv[2], "r")
    
    outputFile = sys.stdout
    if len(sys.argv) >= 4:
        if(sys.argv[3] != '-'):
            outputFile = open(sys.argv[3], "w")
    
    filterAlarmRows(inputFile, outputFile, alarmLevel, ALARM_COLUMN)
    inputFile.close()
    outputFile.close()
    sys.exit(0)